package com.kucowka.struts.tags;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;

public class AddTag extends TagSupport {

	private int num1, num2;

	public void setNum1(int num1) {
		this.num1 = num1;
	}

	public void setNum2(int num2) {
		this.num2 = num2;
	}

	public int doStartTag() throws JspException {
		try {
			pageContext.getOut().print("Welcome to First Grade Math! ");
			pageContext.getOut().print(
					"The sum of: " + num1 + " and " + num2 + " is: "
							+ (num1 + num2));
		} catch (IOException ioe) {
			throw new JspException("Error: IOException while writing to client");
		}
		return SKIP_BODY;
	}
}
